Click here to return to the VHDL Reference Guide. (last edit: 24. september 2012)

Numeric_Std

Numeric_std is a new IEEE standard package which defines arithmetic operations on arrays of Std_logic. The intent is that this package should be supported by all synthesis tools. The package defines two new types to represent numbers:
  type UNSIGNED is array (NATURAL range <>) of STD_LOGIC;
  type SIGNED   is array (NATURAL range <>) of STD_LOGIC;
Operators overloaded on combinations of the types UNSIGNED and NATURAL, and on combinations of the types SIGNED and INTEGER:
  "+" "-" "*" "/" "rem" "mod" ">" ">=" "<" "<=" "=" "/="
Shift operators overloaded on types UNSIGNED and SIGNED:
  "sll" "srl" "rol" "ror"
    
Operators overloaded on type SIGNED only:
  "abs" "-" {signs}
    
Logical operators overloaded on types UNSIGNED and SIGNED:
  "not" "and" "or" "nand" "nor" "xor" "xnor"
    
Functions to do signed and unsigned extension:
  function RESIZE (ARG: SIGNED; NEW_SIZE: NATURAL)
                 return SIGNED;
  function RESIZE (ARG: UNSIGNED; NEW_SIZE: NATURAL)
                 return UNSIGNED;
    
Type conversion functions:
  function TO_INTEGER (ARG: UNSIGNED)                    return NATURAL;
  function TO_INTEGER (ARG: SIGNED)                      return INTEGER;
  function TO_UNSIGNED(ARG, SIZE: NATURAL)
                                                         return UNSIGNED;
  function TO_SIGNED  (ARG: INTEGER; SIZE: NATURAL)
                                                         return SIGNED;
    
Functions which match '-' with any value, but match 'U', 'X', 'W' and 'Z' with nothing except '-'.
  function STD_MATCH (L, R: STD_ULOGIC) return BOOLEAN;
  function STD_MATCH (L, R: UNSIGNED)                    return BOOLEAN;
  function STD_MATCH (L, R: SIGNED)                      return BOOLEAN;
  function STD_MATCH (L, R: STD_LOGIC_VECTOR)
                                                         return BOOLEAN;
  function STD_MATCH (L, R: STD_ULOGIC_VECTOR)
                                                         return BOOLEAN;

  Functions which convert '0' and 'L' to '0', '1' and 'H' to '1', and everything else
  to XMAP
   function TO_01 (S: UNSIGNED; XMAP: STD_LOGIC := '0')
                                                            return UNSIGNED;
   function TO_01 (S: SIGNED;   XMAP: STD_LOGIC := '0')
                                                            return SIGNED;
    

See Also

Standard, Std_logic_1164